﻿
local ESN_Mount = ESN_Mount
if not ESN_Mount then return end


local GAP = 8
local tekcheck = LibStub("tekKonfig-Checkbox")


local frame = CreateFrame("Frame", nil, UIParent)
frame.name = "ESN_Mount"
frame:Hide()
frame:SetScript("OnShow", function()
	local title, subtitle = LibStub("tekKonfig-Heading").new(frame, "ESN_Mount", "These settings allow you to choose when to swap mount speed equipment.")

	local raidswap = tekcheck.new(frame, nil, "Swap when in a raid instance", "TOPLEFT", subtitle, "BOTTOMLEFT", -2, -GAP)
	raidswap.tiptext = "Enable equipment swapping when in a raid instance."
	raidswap:SetChecked(not ESN_Mount.db.raidsuspend)
	local checksound = raidswap:GetScript("OnClick")
	raidswap:SetScript("OnClick", function(self) checksound(self); ESN_Mount.db.raidsuspend = not ESN_Mount.db.raidsuspend end)

	local pvpswap = tekcheck.new(frame, nil, "Swap when PvP flagged", "TOPLEFT", raidswap, "BOTTOMLEFT", 0, -GAP)
	pvpswap.tiptext = "Enable equipment swapping when PvP flagged."
	pvpswap:SetChecked(not ESN_Mount.db.PvPsuspend)

	local bgswap, bgswaplabel = tekcheck.new(frame, nil, "Swap in Battlegrounds", "TOPLEFT", pvpswap, "BOTTOMLEFT", GAP*2, -GAP)
	bgswap.tiptext = "Enable equipment swapping when in a battleground."
	bgswap:SetChecked(not ESN_Mount.db.BGsuspend)
	if ESN_Mount.db.PvPsuspend then
		bgswap:Disable()
		bgswaplabel:SetFontObject(GameFontDisable)
	else
		bgswap:Enable()
		bgswaplabel:SetFontObject(GameFontHighlight)
	end

	pvpswap:SetScript("OnClick", function(self)
		checksound(self)
		ESN_Mount.db.PvPsuspend = not ESN_Mount.db.PvPsuspend
		if ESN_Mount.db.PvPsuspend then
			bgswap:Disable()
			bgswaplabel:SetFontObject(GameFontDisable)
		else
			bgswap:Enable()
			bgswaplabel:SetFontObject(GameFontHighlight)
		end
	end)
	bgswap:SetScript("OnClick", function(self) checksound(self); ESN_Mount.db.BGsuspend = not ESN_Mount.db.BGsuspend end)

	frame:SetScript("OnShow", nil)
end)

InterfaceOptions_AddCategory(frame)


LibStub("tekKonfig-AboutPanel").new("ESN_Mount", "ESN_Mount")



